package com.yudaxian.springbootredis.controller;

import com.alibaba.fastjson2.JSONObject;
import org.springframework.cache.annotation.CachePut;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/redis")
public class UserController {

    @PostMapping("/getUserInfo")
    @CachePut(value = "userInfo", key = "'userInfo'")
    public JSONObject getUserInfo() {
        JSONObject obj = new JSONObject();
        obj.put("name", "yudaxian");
        return obj;
    }

}
